maven私有库神坑之:“Downloading: http://repo.maven.apache.org/maven2/”

您所在的位置:网站首页 can not transfer artifact org maven私有库神坑之:“Downloading: http://repo.maven.apache.org/maven2/”

maven私有库神坑之:“Downloading: http://repo.maven.apache.org/maven2/”

2023-08-12 05:24| 来源: 网络整理| 查看: 265

现象:

即使你配置了私有库,并且在maven setting.xml中配置了mirror,但是,经常会遇到执行mvn命令的时候,会提醒: Downloading: http://repo.maven.apache.org/maven2/

原因:

所有自定义pom.xml都是继承自super pom: http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html super pom中有如下内容:

central Central Repository http://repo.maven.apache.org/maven2 default false central Central Repository http://repo.maven.apache.org/maven2 default false never

因此,当maven项目需要下载一些metadata、pom、jar的时候,会优先去中央仓库下载,导致内网用户各种报错!

解决办法: 在项目pom.xml中添加如下配置: central http://host:port/content/groups/public central http://host:port/content/groups/public

参考: https://blog.sonatype.com/using-nexus-3-as-your-repository-part-1-maven-artifacts https://stackoverflow.com/questions/12789488/how-do-you-stop-maven-from-trying-to-access-http-repo-maven-apache-org



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3